<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
    <head> 
        <title></title> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
        <script type="text/javascript" src="amq.js"></script> 
        <!-- <script type="text/javascript">amq.uri='amq';</script> 
        <script type="text/javascript" src="jquery-1.10.2.min.js"></script> -->
        
        
            <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="js/amq_jquery_adapter.js"></script>

    <script type="text/javascript" src="js/amq.js"></script>
    <script type="text/javascript" src="js/chat.js"></script>
        <script type="text/javascript"> 
        var amq = org.activemq.Amq;

        window.onload = function() {
        	 amq.init({ 
        		    uri: 'amq', 
        		    logging: true,
        		    timeout: 20
        		  });
        };
        
           function listener(message) { 
                jQuery("#receive").append("<p>" + message.nodeType + "." + message.nodeValue + "</p>"); 
            }; 
            function pollHandler(first) { 
                if (first) { 
                    amq.addListener("test", "topic://test", listener); 
                } 
            }; 
            jQuery(function(){ 
            	
            	
                jQuery("#send").click(function(){ 
                    amq.sendMessage("topic://test", "[\"Hello\", \"Hello\"]");
                }); 
                jQuery("#clear").click(function(){ 
                    jQuery("#receive").html(""); 
                }); 
                amq.addPollHandler(pollHandler); 
            }) 
        </script> 
    </head> 
    <body> 
        <button id="send">发送</button> 
        <button id="clear">清理</button> 
        <div id="receive"></div> 
    </body> 
</html> 